package com.samehope.ar.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.samehope.ar.dto.ProblemQueryParam;
import com.samehope.ar.entity.Problem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.ProblemDetailVO;
import com.samehope.ar.vo.ProblemTableVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 问题 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface ProblemMapper extends BaseMapper<Problem> {

    /**
     * 根据项目和问题查找问题单
     * @param projectId
     * @param problemId
     * @return
     */
    Problem findByProjectAndProblem(@Param("projectId") Long projectId,
                                    @Param("problemId") Long problemId);

    /**
     * 根据项目和问题查找明细
     * @param projectId
     * @param problemId
     * @return
     */
    ProblemDetailVO findDetailByProjectAndProblem(@Param("projectId") Long projectId,
                                                  @Param("problemId") Long problemId);

    /**
     * 分页查找问题清单
     * @param page
     * @param problemQueryParam
     * @return
     */
    List<ProblemTableVO> problemsByProjectAndParam(Page<ProblemTableVO> page,
                                                   @Param("projectId") Long projectId,
                                                   @Param("param") ProblemQueryParam problemQueryParam);
}
